home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 October / CHIP Turkiye Ekim 2000.iso / prog / naps / 04 / setup.exe / Gnucleus / GnucleusDoc.h < prev    next >
C/C++ Source or Header  |  2000-07-15  |  4KB  |  177 lines

  1. // GnucleusDoc.h : interface of the CGnucleusDoc class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4.  
  5. #if !defined(AFX_GNUCLEUSDOC_H__1AE2E5D0_1AB4_11D4_ACF2_00A0CC533D52__INCLUDED_)
  6. #define AFX_GNUCLEUSDOC_H__1AE2E5D0_1AB4_11D4_ACF2_00A0CC533D52__INCLUDED_
  7.  
  8. #if _MSC_VER > 1000
  9. #pragma once
  10. #endif // _MSC_VER > 1000
  11.  
  12. #include "packet.h"            // Packet type definitions
  13. #pragma warning(disable: 4786)
  14. #include <vector>
  15. #include <set>
  16. #include <list>
  17. #include <afxtempl.h>        // Support for templated classes like CList
  18.  
  19. class CGnucleusDoc : public CDocument
  20. {
  21.     friend class CGnuTransfer;
  22.     friend class CGnuHash;
  23.     friend class CGnuSock;
  24.     friend class CGnuControl;    
  25.  
  26. protected: // create from serialization only
  27.     
  28.     DECLARE_DYNCREATE(CGnucleusDoc)
  29.  
  30. // Attributes
  31. public:
  32.     // Should be protected, but there's no other way to have a single doc
  33.     CGnucleusDoc();
  34.  
  35.     // Data lists
  36.     CList<CString,CString&> Connections;
  37.  
  38.     CList<CString,CString&> QueueConnect;
  39.     CList<CString,CString&> QueueDisconnect;
  40.     
  41.     CList<QueryItem,QueryItem&> ActiveDownloads;
  42.     CList<QueryItem,QueryItem&> QueueDownloads;
  43.     CList<QueryItem,QueryItem&> QueueUploads;
  44.  
  45.     std::vector<BlockedSearch> SearchFilter;
  46.     void UpdateSearchViews(packet_QueryReply *);
  47.  
  48.     CString Title;
  49.     DWORD   TotalHosts;
  50.     DWORD   m_EstSpeed;
  51.  
  52.     int ActiveUploads;
  53.  
  54.     CGnuControl *GnuComm;
  55.  
  56.     /***** GNUCLEUS GLOBAL SETTINGS *****/
  57.  
  58.     // Connect
  59.     long  m_ConstPort;
  60.     long  m_ConnectSpeed;
  61.     IP      m_ForceIP;
  62.     int   m_MonitorType;
  63.     int   m_ConnectNum;
  64.     int   m_TimeoutConnect;
  65.     bool  m_DropForIncoming;
  66.  
  67.     // Search
  68.     int   m_MaxReplies;
  69.     bool  m_bNewAlgorithm;
  70.         // <-- List of Search permissions
  71.         // <-- List of Node permissions
  72.  
  73.     // Download
  74.     CString m_DownloadDir;
  75.     int     m_MaxDownloads;
  76.     bool    m_AutoClearDL;
  77.     int     m_TimeoutDownload;
  78.     bool    m_ResumeDL;
  79.  
  80.     // Upload
  81.     int  m_MaxUploads;
  82.     bool m_AutoClearUL;
  83.     std::vector<CString> SharedDirList;
  84.     std::vector<DWORD>   SharedDirSize;
  85.     std::vector<DWORD>   SharedDirCount;
  86.     std::vector<SharedFile> SharedFiles;
  87.     std::vector<DWORD>   SharedSizes;
  88.  
  89.     void LockUploadData (bool writeAccess);        // Call this before reading or writing the upload data
  90.     void UnlockUploadData (bool writeAccess);    // Call this when done reading / writing the upload data
  91.  
  92.     // Bandwidth
  93.     bool m_AutoDropDL;
  94.     bool m_AutoDropUL;
  95.     int  m_LimitTotal;
  96.     int  m_LimitUp;
  97.     int  m_BwVisual;
  98.  
  99.     // Language
  100.         // <-- List of language modules
  101.  
  102.  
  103. // Operations
  104. public:
  105.     // Saved Hosts file functions
  106.     void ReadHostsFile();
  107.     void WriteHostsFile();
  108.  
  109.     // INI file functions
  110.     void ReadINI();
  111.     void WriteINI();
  112.  
  113.     // Load share list
  114.     void LoadShare();
  115.     void RecurseShare(CString, bool, DWORD &, DWORD &);
  116.  
  117.     void AddToQueueCache(const CString& inHostPort); 
  118.     void RemoveEarliestHostPort(CString* outHostPort);
  119.  
  120.     // Add search request to spy window.
  121.     void UpdateSpy( CString searchText );
  122.  
  123.     CList<CString,CString&> SavedHosts;
  124.  
  125. // Overrides
  126.     // ClassWizard generated virtual function overrides
  127.     //{{AFX_VIRTUAL(CGnucleusDoc)
  128.     public:
  129.     virtual BOOL OnNewDocument();
  130.     virtual void Serialize(CArchive& ar);
  131.     //}}AFX_VIRTUAL
  132.  
  133. // Implementation
  134. public:
  135.     CString m_strLangDLLex;
  136.     HINSTANCE m_hLangDLL;
  137.     virtual ~CGnucleusDoc();
  138. #ifdef _DEBUG
  139.     virtual void AssertValid() const;
  140.     virtual void Dump(CDumpContext& dc) const;
  141. #endif
  142.  
  143. protected:
  144.  
  145.     
  146. // Generated message map functions
  147. protected:
  148.     //{{AFX_MSG(CGnucleusDoc)
  149.         // NOTE - the ClassWizard will add and remove member functions here.
  150.         //    DO NOT EDIT what you see in these blocks of generated code !
  151.     //}}AFX_MSG
  152.     DECLARE_MESSAGE_MAP()
  153.  
  154.     int m_readCount;
  155.     int m_writeCount;
  156.  
  157. private:
  158.     class QueueCache
  159.     {
  160.     public:
  161.         std::set<CString>                        mHostPorts;
  162.         std::list<std::set<CString>::iterator>    mHostPortsQueue;
  163.  
  164.         void PurgeEarliestHostPort(void);
  165.         void AppendLatestHostPort(const CString& inHostPort);
  166.     } ;
  167.  
  168.     QueueCache    mQueueCache;
  169. };
  170.  
  171. /////////////////////////////////////////////////////////////////////////////
  172.  
  173. //{{AFX_INSERT_LOCATION}}
  174. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  175.  
  176. #endif // !defined(AFX_GNUCLEUSDOC_H__1AE2E5D0_1AB4_11D4_ACF2_00A0CC533D52__INCLUDED_)
  177.